﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		IPluginRepository.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using System.Collections.Generic;
using Dexter.Domain.Model;
using Dexter.Domain.Results;

namespace Dexter.Repository {
	/// <summary>
	/// 	Rapresents a repository of <see cref = "Plugin" />.
	/// </summary>
	public interface IPluginRepository : IRepository <Plugin> {

		///<summary>
		///	Return a list of <see cref="Plugin" /> .
		///</summary>
		///<remarks>
		///	The return value could be null if the repository doesn't contain disabled plugin.
		///</remarks>
		IList<Plugin> GetAllPlugins();

		/// <summary>
		/// Gets the plugin by unique key. <see cref="Plugin.Identifier"/>
		/// </summary>
		/// <param name="identifier">The unique key.</param>
		/// <returns>An instance of <see cref="Plugin"/>. The result could be null if the plugin doesn't exist.</returns>
		Plugin GetPluginByIdentifier(Guid identifier);

		///<summary>
		///	Saves the specified <see cref="Plugin" /> into the repository.
		///</summary>
		///<param name="item"> The item. </param>
		///<exception cref="ArgumentNullException">If
		///	<paramref name="item" />
		///	is
		///	<c>null</c>
		///	.</exception>
		void SaveOrUpdate(Plugin item);

		///<summary>
		///	Deletes the specified <see cref="Plugin" /> from the repository.
		///</summary>
		///<param name="item"> The item. </param>
		///<exception cref="ArgumentNullException">If
		///	<paramref name="item" />
		///	is
		///	<c>null</c>
		///	.</exception>
		void Delete(Plugin item);

		/// <summary>
		/// 	Saves the or update data.
		/// </summary>
		/// <param name="data"> The data. </param>
		/// <exception cref="ArgumentNullException">If
		/// 	<paramref name="data" />
		/// 	is
		/// 	<c>null</c>
		/// 	.</exception>
		void SaveOrUpdateData(PluginData data);

		/// <summary>
		/// Retireve a paged list of <see cref="PluginData"/> .
		/// </summary>
		/// <param name="plugin">The plugin.</param>
		/// <param name="key">The key <see cref="PluginData.Key"/> .</param>
		/// <returns>
		/// An instance of <see cref="PluginData"/> . The result could be <c>null</c> if there isn't data for the specified key.
		/// </returns>
		/// <exception cref="ArgumentNullException">If
		///   <paramref name="key"/>
		/// is
		///   <c>null</c>
		/// .</exception>
		///   
		/// <exception cref="ArgumentException">If
		///   <paramref name="key"/>
		/// is empty.</exception>
		PluginData RetrieveDataFromKey(Plugin plugin, string key);

		/// <summary>
		/// Retireve a paged list of <see cref="PluginData"/> for the specified registration date.
		/// </summary>
		/// <param name="plugin">The plugin.</param>
		/// <param name="creationDate">The creation date.</param>
		/// <param name="pageSize">The number of items to retrieve.</param>
		/// <param name="pageIndex">Index of the page (0 based).</param>
		/// <returns>
		/// An concrete implementation of <see cref="IPagedResult{T}"/> . The result will never be null.
		/// </returns>
		/// <exception cref="ArgumentOutOfRangeException">If
		///   <paramref name="pageIndex"/>
		/// is lesser than 0.</exception>
		///   
		/// <exception cref="ArgumentOutOfRangeException">If
		///   <paramref name="pageSize"/>
		/// is lesser than 1.</exception>
		IPagedResult<PluginData> RetrieveDataFromCreationDate(Plugin plugin, DateTime creationDate, int pageSize, int pageIndex);

		/// <summary>
		/// Retireve a paged list of <see cref="PluginData"/> for the specified registration date range.
		/// </summary>
		/// <param name="plugin">The plugin.</param>
		/// <param name="startDate">The start date.</param>
		/// <param name="endDate">The end date.</param>
		/// <param name="pageSize">The number of items to retrieve.</param>
		/// <param name="pageIndex">Index of the page (0 based).</param>
		/// <returns>
		/// An concrete implementation of <see cref="IPagedResult{T}"/> . The result will never be null.
		/// </returns>
		/// <exception cref="ArgumentOutOfRangeException">If
		///   <paramref name="pageIndex"/>
		/// is lesser than 0.</exception>
		///   
		/// <exception cref="ArgumentOutOfRangeException">If
		///   <paramref name="pageSize"/>
		/// is lesser than 1.</exception>
		IPagedResult<PluginData> RetrieveDataForSpecifiedDateRange(Plugin plugin, DateTime startDate, DateTime endDate, int pageSize, int pageIndex);
	}
}
